/// 创建Router的宏
/// # Examples
/// ```
/// use axum_common::{router, R};
/// use axum::routing::{get, post};
/// let app = router![
///         ("/root1", get, root1);
///         ("/root2", post, root2);
///  ];
/// async fn root1() -> R<&'static str> {
///     R::success("root1")
/// }
///
/// async fn root2() -> R<&'static str> {
///     R::success("root2")
/// }
/// // 等价于
/// let app = {
///     let router = axum::Router::new();
///     let router = router.route("/root1", get(root1));
///     let router = router.route("/root2", post(root2));
///     router
/// };
/// ```
#[macro_export]
macro_rules! router {
    (
        $path:literal, $handler:ident
    ) => {
       {
           axum::Router::new().route($path, post($handler))
       }
    };
    
    (
        $path:literal, $method:ident, $handler:ident
    ) => {
       {
           axum::Router::new().route($path, $method($handler))
       }
    };
    
    (
        $(
            ($path:literal, $handler:ident);
        )+
    ) => {
       {
           let router = axum::Router::new();
           $(
               let router = router.route($path, post($handler));
            )+
           router
       }
    };

    (
        $(
            ($path:literal, $method:ident, $handler:ident);
        )+
    ) => {
       {
           let router = axum::Router::new();
           $(
               let router = router.route($path, $method($handler));
            )+
           router
       }
    };
}